#pragma once
#include "render/RendererAPI.h"

namespace Cogs {
	class RenderCommand {
	public:
		inline static void Init() {
			s_RendererAPI->Initial();
		}

		inline static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
			s_RendererAPI->SetViewPort(x, y, width, height);
		}
		
		inline static void SetClearColor(const glm::vec4& color) {
			s_RendererAPI->ClearColor(color);
		}

		inline static void ClearBuffer() {
			s_RendererAPI->ClearBuffer();
		}

		inline static void DrawIndexed(const std::shared_ptr<VertexArray>& vertexArray, uint32_t indexcount = 0,
			const  std::string& shaderName = "ColorShader") {
			s_RendererAPI->DrawIndex(vertexArray, indexcount, shaderName);
		}

		inline static void CreateUserShader(const std::string& name,
			const std::unordered_map<ShaderType, std::string>& shaderTypeAndSorce) {
			s_RendererAPI->CreateUserShader(name, shaderTypeAndSorce);
		}

		inline static void LoadUserShader(const std::string& name,
			const std::unordered_map<ShaderType, std::string>& shaderTypeAndFilePath) {
			s_RendererAPI->LoadUserShader(name, shaderTypeAndFilePath);
		}

		inline static std::shared_ptr<Shader> GetUserShader(const std::string& name) {
			return s_RendererAPI->GetUserShader(name);
		}
	private:
		static std::shared_ptr<RendererAPI> s_RendererAPI;
	};

	void InitialRendererContext();
}